DLLcall

Syntax: @DLLcall FuncName, Params[, Params][, Returnval]

The DLLcall command makes a call to a previously opened Dynamic Link Library (DLL) function, opened using @DLLopen.

FuncName is a previously opened DLL function. Params is the parameter list, followed by the returned value Returnval (Returnval is optional, depending upon the DLLopen command). The format of which can be Param, Param, Param..., Returnval

See also the topic on Dynamic Link Libraries.

Example:

@DLLopen 'MYDLL.DLL', 'MyFunc', *N,S:I

@DLLcall 'MyFunc', num_1, MyStr, num_2

The call to the function Myfunc (which is in the DLL called Mydll) passes the values in num_1 and Mystr and gets the returned value back in num_2.

Type compatibility

S parameters can use literal strings, string arrays, list attributes and strings variables. I and *I and *N parameters can use literal numeric's, numeric variables, and numeric Attributes.

Arrays

When passing arrays in the parameters of a DLL follow this example:

@DLLopen 'GA.DLL', 'CalcCost', *N, *N

@DLLcall 'CalcCost', GeneArray[1], Cost

The *N indicates that the parameter is being passed by reference.

You cannot pass an array of type integer. To achieve this, pass the array as an array of type double (*N) and truncate the doubles within your DLL.

...in Delphi:

TYPE

NumType = Array[0..0] of double;

PROCEDURE CalcCost(var Genes : NumType; var Cost : double); export; pascal;

...in C:

#define

DllExport __declspec (dllexport)

DllExport void __pascal CalcCost(double *Genes, double *Cost)

Using user defined DLL commands

Syntax: @user_def_command [parameter][, parameter]

XpertRule developers are not restricted to solely using the DLLcall command to call Dynamic Link Libraries. User defined commands can alternatively be implemented, which are effectively defined by using the DLLopen command to open a Dynamic Link Library and name it as a user defined command.

Example

@DLLopen 'CALLSQL.DLL' 'FUNC' S:I

@FUNC variable, variable